import request from '@/utils/request'
const baseUrl = '/mall/order'

export function addOrder(orderList) {
  return request({
    url: `${baseUrl}/addOrder`,
    method: 'post',
    data: orderList
  })
}

export function getUserOrderPage(params) {
  return request({
    url: `${baseUrl}/pageCollectionByUserId/${params.userId}/${params.pageNum}/${params.pageSize}`,
    method: 'get'
  })
}

// 已支付
export function updateToPay(orderId) {
  return request({
    url: `${baseUrl}/updateToPayOk/${orderId}`,
    method: 'put'
  })
}

// 运输中
export function updateToSport(orderId) {
  return request({
    url: `${baseUrl}/updateToTranSport/${orderId}`,
    method: 'put'
  })
}

// 已完成
export function updateToFinish(orderId) {
  return request({
    url: `${baseUrl}/updateToTranOK/${orderId}`,
    method: 'put'
  })
}

// 已取消
export function updateToCancel(orderId) {
  return request({
    url: `${baseUrl}/updateToTranNOT/${orderId}`,
    method: 'put'
  })
}

// 删除订单
export function deleteOrderById(orderId) {
  return request({
    url: `${baseUrl}/deleteById/${orderId}`,
    method: 'delete'
  })
}

